home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / VPOJAVA.DLL / SOURCE / PASSWORD_DIALOG < prev    next >
Text File  |  1998-12-10  |  3KB  |  112 lines

  1. import java.awt.*;
  2.  
  3. import symantec.itools.awt.util.dialog.ModalDialog;
  4.  
  5. public class PasswordDialog extends ModalDialog
  6. {
  7.     public PasswordDialog(Frame parent, String title)
  8.     {
  9.         super(parent, title);
  10.  
  11.         // This code is automatically generated by Visual Cafe when you add
  12.         // components to the visual environment. It instantiates and initializes
  13.         // the components. To modify the code, only use code syntax that matches
  14.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  15.         // parse your Java file into its visual environment.
  16.         //{{INIT_CONTROLS
  17.         setLayout(null);
  18.         setSize(215,130);
  19.         setVisible(false);
  20.         nameLabel.setText("Name:");
  21.         add(nameLabel);
  22.         nameLabel.setBounds(10,32,75,15);
  23.         passwordLabel.setText("Password:");
  24.         add(passwordLabel);
  25.         passwordLabel.setBounds(10,60,75,15);
  26.         add(userTextField);
  27.         userTextField.setBounds(85,28,100,22);
  28.         passTextField.setEchoChar('*');
  29.         add(passTextField);
  30.         passTextField.setBounds(85,57,100,22);
  31.         okButton.setLabel("OK");
  32.         add(okButton);
  33.         okButton.setBackground(java.awt.Color.lightGray);
  34.         okButton.setBounds(80,95,20,40);
  35.         //}}
  36.  
  37.         //{{REGISTER_LISTENERS
  38.         //}}
  39.     }
  40.     
  41.     public PasswordDialog(Frame parent)
  42.     {
  43.         this(parent, "Username/Password");
  44.     }
  45.  
  46.     // Add a constructor for Interactions (ignoring modal)
  47.     public PasswordDialog(Frame parent, boolean modal)
  48.     {
  49.         this(parent);
  50.     }
  51.  
  52.     // Add a constructor for Interactions (ignoring modal)
  53.     public PasswordDialog(Frame parent, String title, boolean modal)
  54.     {
  55.         this(parent, title);
  56.     }
  57.  
  58.     public String getUserName()
  59.     {
  60.         return userTextField.getText();
  61.     }
  62.  
  63.     public String getPassword()
  64.     {
  65.         return passTextField.getText();
  66.     }
  67.  
  68.     public void setUserName(String name)
  69.     {
  70.         userTextField.setText(name);
  71.     }
  72.  
  73.     public void setPassword(String pass)
  74.     {
  75.         passTextField.setText(pass);
  76.     }
  77.     
  78.     public void addNotify()
  79.     {
  80.           // Record the size of the window prior to calling parents addNotify.
  81.         Dimension d = getSize();
  82.  
  83.         super.addNotify();
  84.  
  85.         if (fComponentsAdjusted)
  86.             return;
  87.  
  88.         // Adjust components according to the insets
  89.         Insets insets = getInsets();
  90.         setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height);
  91.         Component components[] = getComponents();
  92.         for (int i = 0; i < components.length; i++)
  93.         {
  94.             Point p = components[i].getLocation();
  95.             p.translate(insets.left, insets.top);
  96.             components[i].setLocation(p);
  97.         }
  98.         fComponentsAdjusted = true;
  99.     }
  100.  
  101.     // Used for addNotify check.
  102.     boolean fComponentsAdjusted = false;
  103.  
  104.     //{{DECLARE_CONTROLS
  105.     java.awt.Label nameLabel = new java.awt.Label();
  106.     java.awt.Label passwordLabel = new java.awt.Label();
  107.     java.awt.TextField userTextField = new java.awt.TextField();
  108.     java.awt.TextField passTextField = new java.awt.TextField();
  109.     java.awt.Button okButton = new java.awt.Button();
  110.     //}}
  111. }
  112.